function init_page(){
    {% for tax in taxSets %}
        container =  document.getElementById("{{tax['shortname']}}");
        retail_sale = document.getElementById("{{tax['shortname']}}_retail_sale");	
        {% for liability in liabilityAccounts %}
            opt = document.createElement('option');
            opt.text = "{{liability['id']}} - {{liability['name']}}";
            opt.value = "{{liability['id']}}";
            {% if linkedAccountDetails %}
                {% for linkedAccount in linkedAccountDetails %}
                    {% if linkedAccount['transaction_tax_shortname']==tax['shortname'] and linkedAccount['account_id']==liability['id'] %}
                        opt.selected = "selected";
                        span = document.createElement('span');
                        span.innerHTML = "<img width='21' height='15' src='/check_right.gif' alt='right'/>";
                        container.insertBefore(span,retail_sale.nextSibling);
                    {% endif %}
                {% endfor %}
            {% endif %}
			if(navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Opera")>=0){
				retail_sale.add(opt);		
			}else{
				retail_sale.appendChild(opt);
			}
        {% endfor %}
        {% if not liabilityAccounts%}
            em = document.createElement('em');
            em.innerHTML = 'You need to create a LIABILITY account';
            container.insertBefore(em,retail_sale.nextSibling);
        {% endif %}
        
		{% if tax['track_on_purchases'] %}
				retail_purchase = document.getElementById("{{tax['shortname']}}_retail_purchase");		
				{% for asset in assetAccounts %}
					opt = document.createElement('option');
					opt.text = "{{asset['id']}} - {{asset['name']}}";
					opt.value = "{{asset['id']}}";				
					{% if linkedAccountDetails %}
						{% for linkedAccount in linkedAccountDetails %}
							{% if linkedAccount['transaction_tax_shortname']==tax['shortname'] and linkedAccount['account_id']==asset['id'] %}
								opt.selected = "selected";
								span = document.createElement('span');
								span.innerHTML = "<img width='21' height='15' src='/check_right.gif' alt='right'/>";
								container.insertBefore(span,retail_purchase.nextSibling);
							{% endif %}
						{% endfor %}
					{% endif %}					
					if(navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Opera")>=0){
						retail_purchase.add(opt);		
					}else{
						retail_purchase.appendChild(opt);
					}
				{% endfor %}	
				{% if not assetAccounts%}
					em = document.createElement('em');
					em.innerHTML = 'You need to create an ASSET account';
					container.insertBefore(em,retail_purchase.nextSibling);
				{% endif %}
		{% endif %}
    {% endfor %}
}
function user_suggestion(){
    {% for tax in taxSets %}
        retail_sale = document.getElementById("{{tax['shortname']}}_retail_sale");
        if(retail_sale.value==''){
            {% for liability in liabilityAccounts %}
                {% if tax['shortname'].lower() in liability['name'].lower() %}
                    retail_sale.value="{{liability['id']}}";
                {% endif %}
            {% endfor %}
        }
        if(retail_sale.value==''){
            {% for liability in liabilityAccounts %}
                {% if 'tax' in liability['name'].lower() %}
                    retail_sale.value="{{liability['id']}}";
                {% endif %}
            {% endfor %}
        }
		{% if tax['track_on_purchases'] %}
			retail_purchase = document.getElementById("{{tax['shortname']}}_retail_purchase");
			if(retail_purchase.value==''){
				{% for asset in assetAccounts %}
					{% if tax['shortname'].lower() in asset['name'].lower() %}
						retail_purchase.value="{{asset['id']}}";
					{% endif %}
				{% endfor %}
			}
			if(retail_purchase.value==''){
				{% for asset in assetAccounts %}
					{% if 'tax' in asset['name'].lower() %}
						retail_purchase.value="{{asset['id']}}";
					{% endif %}
				{% endfor %}
			}
		{% endif %}
    {% endfor %}
}
